import {useFormDisabled} from "element-plus";
import {computed, ComputedRef} from "vue"

/**
 * 获取表禁用状态
 * 设置了disabled属性，则使用该属性,否则使用全局表单属性
 * @param disabled
 */
export function useDisabledStatus(disabled?: Boolean): ComputedRef<Boolean> {
    const FormDisabled = useFormDisabled()
    return computed(() => {
        if (disabled === true) {
            return true
        }
        return FormDisabled.value
    })
}